package com.easycoding.ums.security.shiro.filter;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.shiro.web.filter.authz.AuthorizationFilter;

import com.easycoding.framework.web.online.SessionUsers;

public class SingleLoginAuthorizationFilter extends AuthorizationFilter {

		
	@Override
	public boolean isAccessAllowed(ServletRequest request,
			ServletResponse response, Object mappedValue) throws IOException, ServletException {
		HttpServletRequest httpServletRequest = (HttpServletRequest) request;
		HttpSession session  = httpServletRequest.getSession();
		if(SessionUsers.getInstance().isSessionOverdue(session.getId())){
			return false;
		}
		return true;
	}
}
